using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class WaybillExceptionMap : EntityTypeConfiguration<WaybillException>
	{
		public WaybillExceptionMap()
		{
			// Primary Key
			this.HasKey(t => t.ExceptionOrderFormId);

			// Properties
			this.Property(t => t.Creator)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.ExceptionStatus)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.ResoneType)
				.HasMaxLength(2);
				
			this.Property(t => t.Resone)
				.IsRequired()
				.HasMaxLength(1000);
				
			this.Property(t => t.StationSubmit)
				.HasMaxLength(20);
				
			this.Property(t => t.StationSubmitReason)
				.HasMaxLength(500);
				
			this.Property(t => t.DisposalStatus)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.Principal)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.Distributor)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.DisposalResult)
				.IsRequired()
				.HasMaxLength(1000);
				
			// Table & Column Mappings
			this.ToTable("WaybillException");
			this.Property(t => t.ExceptionOrderFormId).HasColumnName("ExceptionOrderFormId");
			this.Property(t => t.WaybillNo).HasColumnName("WaybillNo");
			this.Property(t => t.Creator).HasColumnName("Creator");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.ExpressCompanyID).HasColumnName("ExpressCompanyID");
			this.Property(t => t.ExpressCompanyType).HasColumnName("ExpressCompanyType");
			this.Property(t => t.ExceptionStatus).HasColumnName("ExceptionStatus");
			this.Property(t => t.ResoneType).HasColumnName("ResoneType");
			this.Property(t => t.Resone).HasColumnName("Resone");
			this.Property(t => t.StationSubmit).HasColumnName("StationSubmit");
			this.Property(t => t.StationSubmitTime).HasColumnName("StationSubmitTime");
			this.Property(t => t.StationSubmitReason).HasColumnName("StationSubmitReason");
			this.Property(t => t.DisposalStatus).HasColumnName("DisposalStatus");
			this.Property(t => t.Principal).HasColumnName("Principal");
			this.Property(t => t.Distributor).HasColumnName("Distributor");
			this.Property(t => t.GetTime).HasColumnName("GetTime");
			this.Property(t => t.DisposalResult).HasColumnName("DisposalResult");
			this.Property(t => t.DisposalTime).HasColumnName("DisposalTime");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.IsChanged).HasColumnName("IsChanged");
			this.Property(t => t.LmsEOFId).HasColumnName("LmsEOFId");
		}
	}
}

